
GOPATH:=$(shell go env GOPATH)

PB_PATH=../protos
PROJECT_PATH =../../../
export MICRO_REGISTRY=etcd
export MICRO_REGISTRY_ADDRESS=49.235.160.203:12379
export MICRO_API_NAMESPACE=com.dashenwo.srv
export MICRO_WEB_NAMESPACE=com.dashenwo.web
# 协议生成，输出到指定项目位置
#make proto
.PHONY: proto
proto:
    #编译用户protobuf
	rm -rf user_srv/genpb/*
	protoc --proto_path=${GOPATH}/src:${PB_PATH}/srv/user_srv \
	--micro_out=user_srv/genpb \
	--go_out=:user_srv/genpb \
	user.proto
	protoc-go-inject-tag -input=user_srv/genpb/user.pb.go

	#编译搜索服务protobuf
	rm -rf search_srv/genpb/*
	rm -rf search_srv/internal/model/models.pb.*
	protoc --proto_path=${GOPATH}/src:${PB_PATH}/srv/search_srv \
	--micro_out=${PROJECT_PATH} \
	--go_out=:${PROJECT_PATH} \
	search.proto
	protoc --proto_path=${GOPATH}/src:${PB_PATH}/srv/search_srv \
    --go_out=:${PROJECT_PATH} models.proto
	protoc-go-inject-tag -input=search_srv/internal/model/models.pb.go


.PHONY: run_web
run_web:
    #编译用户protobuf
	micro web

.PHONY: run_user
run_user:
    #编译用户protobuf
	go run user_srv/main.go --conf_path=user_srv/conf

.PHONY: run_search
run_search:
    #编译用户protobuf
	go run search_srv/main.go --conf_path=search_srv/conf